#include"enumeration.h"
#include"lagrangian.h"
#include"dimacsFile.h"
#include"vertexOrders.h"
#include"bitMapGraph.h"
#include<stdio.h>

int n;
int m;
extern long set;
extern long sets;
extern long violates;
extern double violates2;
extern double violates22;
extern double limcut;
FILE *out, *file;
char* testeIn[100];
char* testeOut[100];

int numT = 15;
int main(){

testeIn[0]= "instance/anna.col";
testeOut[0] = "Result/annaOut.txt";
testeIn[1]= "instance/david.col";
testeOut[1] = "Result/davidOut.txt";
testeIn[2]= "instance/games120.col";
testeOut[2] = "Result/games120Out.txt";
testeIn[3]= "instance/huck.col";
testeOut[3] = "Result/huckOut.txt";
testeIn[4]= "instance/myciel3.col";
testeOut[4] = "Result/myciel3Out.txt";
testeIn[5]= "instance/myciel4.col";
testeOut[5] = "Result/myciel4Out.txt";
testeIn[6]= "instance/myciel5.col";
testeOut[6] = "Result/myciel5Out.txt";
testeIn[7]= "instance/myciel6.col";
testeOut[7] = "Result/myciel6Out.txt";
testeIn[8]= "instance/myciel7.col";
testeOut[8] = "Result/myciel7Out.txt";
testeIn[9]= "instance/queen5_5.col";
testeOut[9] = "Result/queen5_5Out.txt";
testeIn[10]= "instance/queen6_6.col";
testeOut[10] = "Result/queen6_6Out.txt";
testeIn[11]= "instance/queen7_7.col";
testeOut[11] = "Result/queen7_7Out.txt";
testeIn[12]= "instance/queen8_8.col";
testeOut[12] = "Result/queen8_8Out.txt";
testeIn[13]= "instance/miles250.col";
testeOut[13] = "Result/miles250.col.txt";
testeIn[14]= "instance/queen9_9.col";
testeOut[14] = "Result/queen9_9Out.txt";
testeIn[15]= "instance/miles500.col";
testeOut[15] = "Result/miles500.col.txt";
testeIn[16]= "instance/miles750.col";
testeOut[16] = "Result/miles750Out.txt";
testeIn[17]= "instance/miles1000.col";
testeOut[17] = "Result/miles1000Out.txt";
testeIn[18]= "instance/queen9_9.col";
testeOut[18] = "Result/queen9_9Out.txt";
testeIn[19]= "instance/queen10_10.col";
testeOut[19] = "Result/queen10_10Out.txt";
testeIn[20]= "instance/queen11_11.col";
testeOut[20] = "Result/queen11_11Out.txt";
testeIn[21]= "instance/queen12_12.col";
testeOut[21] = "Result/queen12_12.txt";
testeIn[22]= "instance/DSJC125.1.col";
testeOut[22] = "Result/DSJC125.1Out.txt";
testeIn[23]= "instance/DSJC125.5.col";
testeOut[23] = "Result/DSJC125.5Out.txt";
testeIn[24]= "instance/DSJC125.9.col";
testeOut[24] = "Result/DSJC125.9Out.txt";
testeIn[25]= "instance/graph5.30.col";
testeOut[25] = "Result/graph5.30Out.txt";
testeIn[26]= "instance/graph1.40.col";
testeOut[26] = "Result/graph1.40Out.txt";
testeIn[27]= "instance/graph2.40.col";
testeOut[27] = "Result/graph2.40Out.txt";
testeIn[28]= "instance/graph3.40.col";
testeOut[28] = "Result/graph3.40Out.txt";
testeIn[29]= "instance/graph4.40.col";
testeOut[29] = "Result/graph4.40Out.txt";
testeIn[30]= "instance/graph5.40.col";
testeOut[30] = "Result/graph5.40Out.txt";
testeIn[31]= "instance/graph1.50.col";
testeOut[31] = "Result/graph1.50Out.txt";
testeIn[32]= "instance/graph2.50.col";
testeOut[32] = "Result/graph2.50Out.txt";
testeIn[33]= "instance/graph3.50.col";
testeOut[33] = "Result/graph3.50Out.txt";
testeIn[34]= "instance/graph4.50.col";
testeOut[34] = "Result/graph4.50Out.txt";
testeIn[35]= "instance/graph5.50.col";
testeOut[35] = "Result/graph5.50Out.txt";
testeIn[36]= "instance/graph1.60.col";
testeOut[36] = "Result/graph1.60Out.txt";
testeIn[37]= "instance/graph2.60.col";
testeOut[37] = "Result/graph2.60Out.txt";
testeIn[38]= "instance/graph3.60.col";
testeOut[38] = "Result/graph3.60Out.txt";
testeIn[39]= "instance/graph4.60.col";
testeOut[39] = "Result/graph4.60Out.txt";
testeIn[40]= "instance/graph5.60.col";
testeOut[40] = "Result/graph5.60Out.txt";
testeIn[41]= "instance/graph1.70.col";
testeOut[41] = "Result/graph1.70Out.txt";
testeIn[42]= "instance/graph2.70.col";
testeOut[42] = "Result/graph2.70Out.txt";
testeIn[43]= "instance/graph3.70.col";
testeOut[43] = "Result/graph3.70Out.txt";
testeIn[44]= "instance/graph4.70.col";
testeOut[44] = "Result/graph4.70Out.txt";
testeIn[45]= "instance/graph5.70.col";
testeOut[45] = "Result/graph5.70Out.txt";
testeIn[46]= "instance/graph1.80.col";
testeOut[46] = "Result/graph1.80Out.txt";
testeIn[47]= "instance/graph2.80.col";
testeOut[47] = "Result/graph2.80Out.txt";
testeIn[48]= "instance/graph3.80.col";
testeOut[48] = "Result/graph3.80Out.txt";
testeIn[49]= "instance/graph4.80.col";
testeOut[49] = "Result/graph4.80Out.txt";
testeIn[50]= "instance/graph5.80.col";
	int f = 0;
	for(f = 0; f <= 24; f++){
		double sol;
		file= fopen(testeIn[f], "r");
		int i,j;
		out= fopen(testeOut[f],"w");
		if(!readFile(file, complement, &n, &m)){
	   	    printf(" numero de vertices %d \n", n);
			printf(" numero de arestas %d \n", m);
			int* c = malloc(sizeof(int)*n);
			mcrStableSort(n, c);
			double lang = lagrangian(&sol);
			getValues();
			fprintf(out,"valor do limite: %f \n", lang);
			fprintf(out,"valor da melhor solução: %f\n", sol);
			fprintf(out,"valores da solução:\n");
			/*for(i = 0; i<n; i++){
				for(j = 0; j < n; j++){
						if(weigths[va[i]][va[j]] > 0)fprintf(out, "variavel %lu %lu vale %f\n",va[i]+1,va[j]+1,weigths[va[i]][va[j]]);
				}
			}*/
			printf("\n final do teste!!!\n");
		}else{
			printf("Problemas para ler o arquivo");
			printf("\n cheguei msm");
		}
		fclose(out);
		fclose(file);
	}
	return 0;
}
